package com.example.excel.utils;

import android.content.Context;
import android.util.DisplayMetrics;
import android.view.Display;
import android.view.WindowManager;

public class UIUtils {

    private Context context;

    private static final float SCREEN_WIDTH = 1080F;
    private static final float SCREEN_HEIGHT = 1092F;

    // 实际值  sp MMKV
    private static float defaultDisplayWidth;
    private static float defaultDisplayHeight;

    private UIUtils(Context context) {
        this.context = context;
        WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
        DisplayMetrics metrics = new DisplayMetrics();
        if (defaultDisplayWidth == 0.0F || defaultDisplayHeight == 0.0F) {
            wm.getDefaultDisplay().getMetrics(metrics);
            int systemBarHeight = getSystemBarHeight(context);
            if (metrics.widthPixels > metrics.heightPixels) {
                defaultDisplayWidth = metrics.heightPixels;
                defaultDisplayHeight = metrics.widthPixels - systemBarHeight;
            } else {
                defaultDisplayWidth = metrics.widthPixels;
                defaultDisplayHeight = metrics.heightPixels - systemBarHeight;
            }
        }


    }

    private int getSystemBarHeight(Context context) {
        return 0;
    }
}
